import { StyleSheet, Text, View, Pressable } from 'react-native'
import React from 'react'
import { FlashList } from '@shopify/flash-list' //长列表滚动（高性能）
import { ListItem } from '@rneui/themed'
import { router } from 'expo-router'
import { routes } from '../routes'

const Home = () => {
	const list = [...routes]
	const goTo = (path: string): void => {
		router.push(path)
	}

	return (
		<FlashList
			data={list}
			renderItem={({ item }) => (
				<Pressable
					onPress={() => {
						goTo(item.name)
					}}>
					<ListItem>
						<ListItem.Content>
							<ListItem.Title>{item.title}</ListItem.Title>
							<ListItem.Subtitle>{item.sdk}</ListItem.Subtitle>
						</ListItem.Content>
					</ListItem>
				</Pressable>
			)}
			estimatedItemSize={200}
		/>
	)
}

export default Home

const styles = StyleSheet.create({})
